<?php
header('content-type:text/html;charset=utf-8');
require_once $_SITE_PATH_.'backend/apis/UpFile_ApiClient.class.php';
require_once $_SITE_PATH_.'backend/apis/Queue_Class.php';

$auth='tjiePjfjvnyGUuyMFEXVPmsewokCauuZ';
$json_arr=array('data'=>'','count'=>1);
$json_arr=json_encode($json_arr);
$time=time();

$data=array('apitype'=>'','apiflag'=>'3','flag'=>'coprsys','method'=>'copr.add','type'=>'json','timestamp'=>$time,'charset'=>'utf-8','ver'=>1,'copr_data'=>$json_arr);
$url='http://localhost/index.php?a=apis.multi_id';
//获取当前FLOW>=9的数据源ID
$api=new UpFile_ApiClient();
$id=$api->DoRequest($url,$auth,$data);
$id=json_decode(trim(urldecode($id),chr(239).chr(187).chr(191)),true);
//echo 'aaaaaaaa';
//var_dump($id);

$id_count=count($id);
$queue=new QueueClass();

if($id_count <= 0 || empty($id))
	{
		exit;
	}

for($i=0;$i<$id_count;$i++)
	{
		if($id[$i])
			{
				$queue->add_item($id[$i]);
			}
	}
//echo '<br/>';
//var_dump($queue->get_queue());
$result='';
for($i=$id_count;$i>0;$i--)
	{
		$id=$queue->del_item();//退出队列
		//var_dump($id);
		//echo '<br/>';
		//$auth='Api_multi';
		$data=array('apiid'=>$id,'apiflag'=>'3','flag'=>'coprsys','method'=>'copr.add','type'=>'json','timestamp'=>$time,'charset'=>'utf-8','ver'=>1,'copr_data'=>'');
		////var_dump($data);
		$url='http://copr.hucai.com/index.php?a=apis.Task_List';
		//重新用计划任务执行指定次数的推送数据任务。
		$result=$api->DoRequest($url,$auth,$data);
		var_dump($result);
		exit;
		usleep(100);
	}
var_dump($result);
exit; 
?>